// JavaScript Document

//required Item Functions
function ItemNameClick(the_item)
{
		$("#" + the_item + "_desc").slideToggle('slow');
		return false;
}
function ItemNameMouseOut(the_item)
{
		//$("#" + the_item + "_desc").slideUp('fast');
		return false;
}
function ItemNameMouseOver(the_item)
{
		//$("#" + the_item + "_desc").slideDown('slow');
		return false;
}
function ItemDescriptionClick(the_item)
{
		$("#" + the_item + "_desc").slideToggle('slow');
		return false;
}
function ItemDescriptionMouseOut(the_item)
{
		return false;
}
function ItemDescriptionMouseOver(the_item)
{
		return false;
}


//required Credit Shop function
function PackageBuyClick(nome_do_pacote, valor_do_pacote, creditos, id_do_pacote, SiteFolder)
{
		if (parseInt(creditos) < parseInt(valor_do_pacote))
		{
				alert('Você não tem créditos para comprar este pacote.');
				return false;
		}

		var texto = 'Por favor, confirme a compra:\nPacote: ' + nome_do_pacote + '\nValor: R$' + valor_do_pacote + ',00';
		if (confirm(texto))
		{
				LoadContent('?c=CreditShop/' + id_do_pacote);
		}
}

function LoadContent(theLink)
{
		$("#FerrareziMUWebContentDiv").load(theLink, {ajaxed: 'true'}, function () {
				LoadedEffect();
		});
}

////////////////////////////
////////////////////////////
// REQUIRED IF USING AJAX //
// REQUIRED IF USING AJAX //
// REQUIRED IF USING AJAX //
////////////////////////////
////////////////////////////
$(function ()
{
		$("a, area").live("click", function (event)
		{
				var theLink = $(this).attr("href");
				var theTarget = $(this).attr("target");

				if (theLink != "/" && theLink != "" && theLink != "/index.php?logout" && theLink != "javascript:;" && theLink.indexOf("http://") == -1 && theLink.indexOf("ftp://") == -1 && theLink.indexOf("#") == -1 && theLink.indexOf("mailto:") == -1 && theLink.indexOf("News/") == -1 && theTarget != "_blank")
				{
						event.preventDefault();
						LoadingEffect();
						LoadContent(theLink);
				}
		});

		$("form").live("submit", function () {

				if ($(this).attr("name") == "login_pn")
						return;

				if ($(this).attr("action").indexOf("http") != -1)
						return;

				LoadingEffect();
				$(this).ajaxSubmit(
								{
										data: {ajaxed: 'true'},
										target: '#FerrareziMUWebContentDiv',
										resetForm: false,
										success: function () {
												LoadedEffect();
										}
								});
				return false;
		});
});

function LoadRanking(theLink)
{
		LoadingEffect();
		LoadContent(theLink);
}

function LoadingEffect()
{
		$("#FerrareziMUWebContentDiv").animate({opacity: 0.3}, 100);
}

function LoadedEffect()
{
		$("#FerrareziMUWebContentDiv").animate({opacity: 1.0}, 100);
}